# Copyright 2010-2025 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
load("@rules_cc//cc:cc_library.bzl", "cc_library")

cc_library(
    name = "gen",
    srcs = ["gen.cc"],
    hdrs = ["gen.h"],
    deps = [
        "//ortools/math_opt/elemental:arrays",
        "//ortools/math_opt/elemental:attributes",
        "//ortools/math_opt/elemental:elements",
        "@abseil-cpp//absl/strings",
        "@abseil-cpp//absl/strings:string_view",
        "@abseil-cpp//absl/types:span",
    ],
)

cc_library(
    name = "gen_c",
    srcs = ["gen_c.cc"],
    hdrs = ["gen_c.h"],
    deps = [
        ":gen",
        "@abseil-cpp//absl/log:check",
        "@abseil-cpp//absl/strings",
        "@abseil-cpp//absl/strings:str_format",
        "@abseil-cpp//absl/types:span",
    ],
)

cc_library(
    name = "testing",
    testonly = 1,
    hdrs = ["testing.h"],
    deps = [":gen"],
)

cc_library(
    name = "gen_python",
    srcs = ["gen_python.cc"],
    hdrs = ["gen_python.h"],
    deps = [
        ":gen",
        "@abseil-cpp//absl/strings",
        "@abseil-cpp//absl/strings:str_format",
        "@abseil-cpp//absl/strings:string_view",
        "@abseil-cpp//absl/types:span",
    ],
)

cc_binary(
    name = "codegen",
    srcs = ["codegen.cc"],
    visibility = [
        "//ortools/math_opt/elemental/c_api:__subpackages__",
        "//ortools/math_opt/elemental/python:__subpackages__",
    ],
    deps = [
        ":gen",
        ":gen_c",
        ":gen_python",
        "//ortools/base",
        "@abseil-cpp//absl/flags:flag",
        "@abseil-cpp//absl/log",
        "@abseil-cpp//absl/log:check",
        "@abseil-cpp//absl/strings:string_view",
    ],
)
